using System;
using System.Collections.Generic;
using AdvancedInspector;
using Rilisoft.MiniJson;
using UnityEngine;

[AdvancedInspector(true)]
public class MarathonController : MonoBehaviour
{
	public static MarathonController instance;

	public List<DayMarathon> listDaysMarathon = new List<DayMarathon>();

	public List<DayMarathon> listSuperDaysMarathon = new List<DayMarathon>();

	public float timeToCenGetAwarde = 86400f;

	public bool showImmediately;

	public DayMarathon curDayAward;

	private SaveInt serverTime;

	private string keyPrevServerTime = "keyPrevServerTime";

	private string keyCountDayReceiveAward = "keyCountDayReceiveAward";

	private static string maraphonForIOS = "{\n\t\"is_active\": 1,\n\t\"days_marathon\":\n\t[\n      \t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunGrenade\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunMolotov\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunC4\",\n\t\t\t\"count\": 10,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 50,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 50,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunMolotov\",\n\t\t\t\"count\": 20,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 150,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"FrostGrenade\",\n\t\t\t\"count\": 15,\n\t\t\t\"super_day\": 1\n\t\t}\n\t]\n}";

	private static string maraphonForTest = "{\n\t\"is_active\": 1,\n\t\"days_marathon\":\n\t[\n      \t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunGrenade\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunMolotov\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunC4\",\n\t\t\t\"count\": 10,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunMolotov\",\n\t\t\t\"count\": 20,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 15,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"FrostGrenade\",\n\t\t\t\"count\": 15,\n\t\t\t\"super_day\": 1\n\t\t}\n\t]\n}";

	private static string maraphonForAndroid = "{\n\t\"is_active\": 1,\n\t\"days_marathon\":\n\t[\n      \t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunGrenade\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunMolotov\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 30,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunC4\",\n\t\t\t\"count\": 10,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 50,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 50,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunMolotov\",\n\t\t\t\"count\": 20,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 150,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"FrostGrenade\",\n\t\t\t\"count\": 15,\n\t\t\t\"super_day\": 1\n\t\t}\n\t]\n}";

	private static string maraphonForAmazonStore = "{\n\t\"is_active\": 1,\n\t\"days_marathon\":\n\t[\n      \t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunGrenade\",\n\t\t\t\"count\": 20,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunMolotov\",\n\t\t\t\"count\": 15,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 3,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"GunC4\",\n\t\t\t\"count\": 15,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Cash\",\n\t\t\t\"count\": 500,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"InvisibleConsumable\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 1\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Coins\",\n\t\t\t\"count\": 15,\n\t\t\t\"super_day\": 0\n\t\t},\n\t\t{\n\t\t\t\"id_product\": \"Jetpack\",\n\t\t\t\"count\": 5,\n\t\t\t\"super_day\": 1\n\t\t}\n\t]\n}";

	public int CountDayReceiveAward
	{
		get
		{
			return BCWStorage.Get<int>(keyCountDayReceiveAward);
		}
		set
		{
			BCWStorage.Set(keyCountDayReceiveAward, value);
		}
	}

	public int PrevTimeAward
	{
		get
		{
			int num = BCWStorage.Get<int>(keyPrevServerTime);
			if (num == 0)
			{
				BCWStorage.Set(keyPrevServerTime, (int)serverTime, true);
				return serverTime;
			}
			return num;
		}
		set
		{
			BCWStorage.Set(keyPrevServerTime, value, true);
		}
	}

	public static event Action OnChangeTime;

	public static event Action OnRewardUnavailable;

	[SerializeField]
	private void Awake()
	{
		instance = this;
		showImmediately = false;
		ParseData(JSONManager.Instance.GetJSON(URLs.Marathon));
	}

	private void OnDestroy()
	{
		instance = null;
	}

	public void UpdateTimeMarathon()
	{
		if (MarathonController.OnChangeTime != null)
		{
			MarathonController.OnChangeTime();
		}
	}

	public void GiveAward(DayMarathon awardByDay)
	{
		if (awardByDay.idProduct.ToLower().Equals("cash"))
		{
			settings.ShowSpecialLabelWithAnimation(awardByDay.count, Vector3.zero, false);
		}
		else if (awardByDay.idProduct.ToLower().Equals("coins"))
		{
			settings.ShowLabelWithAnimation(awardByDay.count, Vector3.zero, false);
		}
		else
		{
			MarketController.Instance.BuyProduct(awardByDay.idProduct, true, awardByDay.count);
		}
		settings.SaveCathedExeptionsToStorager();
		LogDailyMarathonStats(CountDayReceiveAward);
	}

	public static void LogDailyMarathonStats(int day)
	{
		Dictionary<string, string> dictionary = new Dictionary<string, string>();
		dictionary.Add("Daily marathon stats", day + " day");
		FlurryWrapper.LogEvent(FlurryWrapper.EV_DAILY_MARATHON_STATS, dictionary);
	}

	public bool CanGetAward()
	{
		return (float)((int)serverTime - PrevTimeAward) > timeToCenGetAwarde || showImmediately;
	}

	public void CheckOnAward()
	{
		if (CanGetAward())
		{
			PrevTimeAward = serverTime;
			CountDayReceiveAward++;
			if (CountDayReceiveAward >= listDaysMarathon.Count)
			{
				CountDayReceiveAward = 1;
			}
			ShowWindowAward();
		}
		else if (MarathonController.OnRewardUnavailable != null)
		{
			MarathonController.OnRewardUnavailable();
		}
	}

	private void ShowWindowAward()
	{
		if (CountDayReceiveAward > 0 && CountDayReceiveAward <= listDaysMarathon.Count)
		{
			curDayAward = listDaysMarathon[CountDayReceiveAward - 1];
			if (BCWDebug.isDebugBuild)
			{
				BCWDebug.Log("ShowWindowAward day " + CountDayReceiveAward + " curAward:" + curDayAward.idProduct);
			}
			MarathonWindow.instance.ShowWindow();
		}
		else
		{
			BCWDebug.LogError("error count day marathon");
		}
	}

	private void ParseData(string text)
	{
		if (string.IsNullOrEmpty(text))
		{
			text = GetStartedInfo();
		}
		Dictionary<string, object> dictionary = Json.Deserialize(text) as Dictionary<string, object>;
		if (dictionary == null)
		{
			BCWDebug.LogError("Cant Deserialize maraphone ! Data = null");
		}
		else if (dictionary.ContainsKey("is_active") && Convert.ToInt32(dictionary["is_active"]) != 1)
		{
			listDaysMarathon.Clear();
			listSuperDaysMarathon.Clear();
			if (BCWDebug.isDebugBuild)
			{
				BCWDebug.Log("Marathon is not active");
			}
		}
		else
		{
			if (!dictionary.ContainsKey("days_marathon"))
			{
				return;
			}
			List<object> list = dictionary["days_marathon"] as List<object>;
			if (list != null)
			{
				List<DayMarathon> list2 = new List<DayMarathon>();
				listSuperDaysMarathon.Clear();
				for (int i = 0; i < list.Count; i++)
				{
					Dictionary<string, object> dictionary2 = list[i] as Dictionary<string, object>;
					if (dictionary2 != null)
					{
						DayMarathon dayMarathon = new DayMarathon();
						dayMarathon.curNumDayAward = i + 1;
						if (dictionary2.ContainsKey("id_product"))
						{
							dayMarathon.idProduct = (string)dictionary2["id_product"];
						}
						if (dictionary2.ContainsKey("super_day"))
						{
							int num = Convert.ToInt32((long)dictionary2["super_day"]);
							dayMarathon.superDay = num == 1;
						}
						if (dictionary2.ContainsKey("count"))
						{
							dayMarathon.count = Convert.ToInt32((long)dictionary2["count"]);
						}
						if (dayMarathon.superDay)
						{
							listSuperDaysMarathon.Add(dayMarathon);
						}
						list2.Add(dayMarathon);
					}
				}
				listDaysMarathon = list2;
			}
			if (JSONManager.Instance.ServerTimeLoad() || showImmediately)
			{
				serverTime = JSONManager.Instance.GetServerTime();
				CheckOnAward();
			}
		}
	}

	private string GetStartedInfo()
	{
		if (BCWDebug.isDebugBuild)
		{
			return maraphonForTest;
		}
		if (Application.platform == RuntimePlatform.Android)
		{
			return maraphonForAndroid;
		}
		return maraphonForIOS;
	}
}
